import request from '@/utils/request'

// 查询实训项目列表
export function listProgram(query) {
    return request({
        url: '/pv/program/list',
        method: 'get',
        params: query
    })
}

// 查询实训项目详细
export function getProgram(id) {
    return request({
        url: '/pv/program/' + id,
        method: 'get'
    })
}

// 新增实训项目
export function addProgram(data) {
    return request({
        url: '/pv/program',
        method: 'post',
        data: data
    })
}

// 导入实训项目
export function importExcel(file) {
  //组装参数
  let form = new FormData();
  form.append("file",file.raw)
  return request({
    url: '/pv/program/import',
    method: 'post',
    data:form,
    headers: {"Content-Type": "multipart/form-data; charset=utf-8"},
    contentType: false,
    processData: false,
    withCredentials: false
  })
}

// 修改实训项目
export function updateProgram(data) {
    return request({
        url: '/pv/program',
        method: 'put',
        data: data
    })
}

// 删除实训项目
export function delProgram(id) {
    return request({
        url: '/pv/program/' + id,
        method: 'delete'
    })
}
